﻿<!DOCTYPE>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <title>实测值附件预览</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
</head>
<body>
    <div class="panelSection">
        <div class="easyui-panel " title="流水卡区域" style="padding: 3px;width: 100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
            <div style="margin: 3px 0px 3px 3px">
                <table id="gdStepDocFileInfo" class="easyui-datagrid" style="width: 100%; height: 400px"
                    data-options="rownumbers:true,singleSelect:true">
                </table>
                <div id="pp" style="float: right" class="easyui-pagination" data-options="   
                 layout:['first','prev','next','last','manual','info'],              
                    total: 0,
                    showPageList: false,
                    showPageInfo: false,
                    showRefresh: false,
                    afterPageText:'共&nbsp{pages}&nbsp页',
                    buttons:[{
                            iconCls:'',
                            text:'Go',
                            id:'pageGo'
                    }]  
                ">
                        </div>
                <div style="clear: both">
                </div>
            </div>
        </div>
    </div>
    <div id="statusMessage" style="font-size: 14px; height: 40px">
    </div>
</body>
</html>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/ReferenceJsLib.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script type="text/javascript">
    /*
    创建人：zhangrj
    日期：2022-11-16
    描述：实测值附件上传预览
    */
    var page = {
        url: getRootPath() + "/Ashx/YePianContainer/YPContaienrHandler.ashx", //后台处理url,
        //设备分页参数
        pageTotal: 0,
        pageSize: 20,
        pageNumber: 1,
        containerID: "",
        init: function () {
            page.parentID = getParam("parentDiv");
            page.containerID = parent.$("#" + page.parentID).dialog('options').poPupData;
            if (page.containerID === "") {
                displayMessage("缓存过期", false);
                return;
            }
            page.bind();
            page.search();
        },
        //绑定事件
        bind: function () {
            customizedEasyuiPagination('pp'); //定制化分页
            //列表加载
            $("#gdStepDocFileInfo").datagrid({
                onLoadSuccess: function (data) {
                    $('#pp').pagination('refresh', {	// 改变选项，并刷新分页栏信息
                        total: page.pageTotal,
                        pageSize: page.pageSize,
                        pageNumber: page.pageNumber
                    });
                    customizedEasyuiPagination('pp'); //定制化分页
                },
                columns: [[
                 { field: 'WORKFLOWSTEPNAME', title: '工序', width: 200 },
                 { field: 'CHECKPOINTNOTE', title: '检测内容', width: 180 },
                 { field: 'WORKERNAME', title: '工人', width: 60 },
                 { field: 'WORKDOCNAME', title: '工人附件', width: 300,
                     formatter: function (value, row, index) {
                         return "<a class='easyui-linkbutton' href='" + row.WORKRESULTDOCPATH + "' style='width: 100px; height: 22px'>" + row.WORKDOCNAME + "</a>";
                     }
                 },
                 { field: 'CHECKDOCNAME', title: '检验附件', width: 300,
                     formatter: function (value, row, index) {
                         if (row.CHECKDOCNAME===null || row.CHECKDOCNAME === "") {
                             return "";
                         }
                         return "<a class='easyui-linkbutton' href='" + row.CHECKRESULTDOCPATH + "' style='width: 100px; height: 22px'>" + row.CHECKDOCNAME + "</a>";
                     }
                 }
                ]]
            });
            //设备列表分页事件
            $('#pp').pagination({
                onSelectPage: function (pageNumber, pageSize) {
                    customizedEasyuiPagination('pp'); //定制化分页
                    page.clearPage(false, true, true);
                    page.pageSize = pageSize; page.pageNumber = pageNumber;
                    page.search();
                }
            });
            $(document).ready(function () {
                //绑定分页go按钮
                $('#pageGo').on("click", function () {
                    page.clearPage(false, true, true);
                    var pageNumber = $(this).parents('tr').find('.pagination-num').val();
                    page.pageNumber = pageNumber;
                    page.search();
                });
            });
        },
        //初始化页面
        search: function () {
            var formData = {
                action: "GetCheckPointDocFileList",
                pageSize: page.pageSize,
                pageIndex: page.pageNumber,
                containerId: page.containerID
            };
            page.post(page.url, formData, true, function (res) {
                if (!res.Result) {
                    displayMessage(res.Message, res.Result);
                    return;
                }
                page.pageTotal = res.RowCount;
                $("#gdStepDocFileInfo").datagrid('loadData', { total: res.RowCount, rows: res.DBTable });
            });
        },
        //post数据（路径，参数，是否异步，成功返回方法）
        post: function (url, param, async, callback) {
            $.ajax({
                type: "Post",
                url: url,
                data: param,
                cashe: false,
                async: async,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                    $("body").find(".easyui-linkbutton").each(function () {
                        $(this).linkbutton('enable');
                    });
                }
            });
        }
    }
    page.init();
</script>
